const path = require('path')
const HTMLWebpackPlugin = require('html-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
  mode: 'development',
  entry: {
    app: './src/index.js'
  },
  output: {
    path: path.resolve(__dirname, '../', 'build'),
    filename: '[name].[hash:8].js'
  },
  plugins: [
    // new HTMLWebpackPlugin() // 默认自动生成了一个全新的html文件，跟public文件夹下index.html文件无关
    new HtmlWebpackPlugin({
      template: './public/index.html',
      title: 'webpack 神奇之旅', // public/index.html <%- htmlWebpackPlugin.options.title %>
      // filename: 'aaa.html' // 默认打包出来的文件名称为index.html，可以更改，一般不设置
    })
  ]
}